package com.erp.module.gongGao

import android.content.Context
import android.util.Log
import com.erp.Interface.OnUserDataInterface
import com.erp.bean.Twostringbean
import com.erp.contacts.Contacts
import com.erp.util.Httputil.Call
import com.erp.util.Httputil.getparams
import org.xutils.http.RequestParams
import org.xutils.x


/**
 * Created by Administrator on 2019/3/13/013.
 * 作者：刘洋
 */
class GongGaoModel : GongGaoContract.GongGaoMP{
    override fun getGongGaoData(context: Context, page: Int, pagesize: Int, searchParams: List<Twostringbean>, onUserDataInterface: OnUserDataInterface) {
        val params = RequestParams(Contacts.GONGGAO)
        getparams(context, params)
        params.addBodyParameter("page", page.toString())
        params.addBodyParameter("pagesize", pagesize.toString())
        if (searchParams != null) {
            for (i in 0 until searchParams.size) {
                val twostringbean = searchParams[i]
                params.addBodyParameter("searchParams[" + twostringbean.name + "]", twostringbean.string)
            }
        }
        Log.d("getGongGaoData","http= "+params.toString())
        x.http().get(params, Call(context, onUserDataInterface))
    }
}